package com.sunshine.client.controller;

import com.sunshine.client.bean.User;
import com.sunshine.client.service.IUserApi;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;

/**
 * @author Mokairui
 * @description frame-module
 * @since 2022/5/8
 */
@RestController
public class TestController {
    
    @Autowired
    private IUserApi userApi;
    
    @GetMapping("/")
    public void test() {
        // 测试信息
        userApi.getAllUser();
        userApi.getUserById("1111111111");
        userApi.deleteUserById("222222222");
        userApi.createUser(Mono.just(User.builder().name("张三").age(18).build()));
        
        // 直接调用实现 rest 接口的效果
//        Flux<User> users = userApi.getAllUser();
//        users.subscribe(System.out::println);
    }
    
    
    
}
